package com.qd.common.sys.domain.sendmsg;


import com.qd.common.sys.domain.entity.msg.MsgReceiveContentDTO;
import lombok.Data;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;

/**
 * @author sjk
 */
@Data
@Accessors(chain = true)
@Slf4j
public class PersonMsg {

    private int level;

    private String logId;

    private String id;
    private short classify;

    private MsgContent msgContent;
    private MsgProperties msgProperties;
    private MsgContentProperties msgReceiveDynProperties;
    private MsgContentProperties msgReceiveCustomProperties;

    private MsgReceiveContentDTO msgReceiveContent;

    private String sendOrgId;

    private UrlParams urlParams;

    private String url;

    private String assStuId;

    private int sendFlag;

    private String fromMsgId;

    private String fromMsgSubId;

    private String appId;

    public PersonMsg() {
    }

    public void free() {
        id = null;
        sendOrgId = null;
        msgContent = null;
        msgProperties = null;
        msgReceiveDynProperties = null;
        msgReceiveCustomProperties = null;
        urlParams = null;
        url = null;
        assStuId = null;
        fromMsgId = null;
        fromMsgSubId = null;
    }

    public boolean isEmptyUrlParams() {
        if (urlParams == null) {
            return true;
        }
        return urlParams.isEmpty();
    }

    public boolean canSendSms() {
        return (sendFlag & FusionMsg.SEND_FLAG_SMS) != 0x0;
    }

    public boolean canSendWeixin() {
        return (sendFlag & FusionMsg.SEND_FLAG_WEIXIN) != 0x0;
    }

    public boolean canSendApp() {
        return (sendFlag & FusionMsg.SEND_FLAG_APP) != 0x0;
    }
}
